/*    */ package com.zimbra.cs.service.admin;
/*    */ 
/*    */ import com.zimbra.common.account.Key.XMPPComponentBy;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.soap.AdminConstants;
/*    */ import com.zimbra.common.soap.Element;
/*    */ import com.zimbra.cs.account.AccountServiceException;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.XMPPComponent;
/*    */ import com.zimbra.cs.account.accesscontrol.AdminRight;
/*    */ import com.zimbra.cs.account.accesscontrol.Rights.Admin;
/*    */ import com.zimbra.soap.ZimbraSoapContext;
/*    */ import java.util.List;
/*    */ import java.util.Map;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class DeleteXMPPComponent
/*    */   extends AdminDocumentHandler
/*    */ {
/*    */   public Element handle(Element request, Map<String, Object> context)
/*    */     throws ServiceException
/*    */   {
/* 43 */     ZimbraSoapContext zsc = getZimbraSoapContext(context);
/* 44 */     Provisioning prov = Provisioning.getInstance();
/*    */     
/* 46 */     Element id = request.getElement("xmppcomponent");
/* 47 */     String byStr = id.getAttribute("by");
/* 48 */     String name = id.getText();
/*    */     
/* 50 */     if ((name == null) || (name.equals(""))) {
/* 51 */       throw ServiceException.INVALID_REQUEST("must specify a value for a xmppcomponent", null);
/*    */     }
/* 53 */     Key.XMPPComponentBy by = Key.XMPPComponentBy.valueOf(byStr);
/*    */     
/* 55 */     XMPPComponent comp = prov.get(by, name);
/* 56 */     if (comp == null) {
/* 57 */       throw AccountServiceException.NO_SUCH_XMPP_COMPONENT(name);
/*    */     }
/*    */     
/* 60 */     checkRight(zsc, context, comp, Rights.Admin.R_deleteXMPPComponent);
/*    */     
/* 62 */     prov.deleteXMPPComponent(comp);
/*    */     
/* 64 */     Element response = zsc.createElement(AdminConstants.DELETE_XMPPCOMPONENT_RESPONSE);
/* 65 */     return response;
/*    */   }
/*    */   
/*    */   public void docRights(List<AdminRight> relatedRights, List<String> notes)
/*    */   {
/* 70 */     relatedRights.add(Rights.Admin.R_deleteXMPPComponent);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/admin/DeleteXMPPComponent.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */